$(function() {

	var id = getQueryString("id");

	showBookStock(id);

	
	function showBookStock(id) {
		$.get({
					url : baseUrl + 'api/book/bookStock/findPage',
					data : {
						bid : id,
						pageNum : 1,
						pageSize : 10
					},
					success : function(data) {
						debugger
						var data = data.data.list;
						$("#jieyue_zhandian_box").empty();
						var htmlOutput = $.templates("#book_borrow_place_tmpl")
								.render(data);
						$("#jieyue_zhandian_box").html(htmlOutput);
					}
				});
	}
	
	$("#confirm").click(function(){
		// 借阅点id
		var pid = $('#jieyue_zhandian_box li b').attr("id");
		
		$.post({
					url : baseUrl + 'api/book/bookReserve/create',
					data : JSON.stringify({
						openid: openid,
						bid: id,
						pid : pid
					}),
					contentType: "application/json",
					success : function(data) {
						var data = data.data;
						window.location.href = "readSuccess.html?successid=3";
					}
				});
	});

		})